file = open('data.txt')

total = 0
while True:
    # 循环读取文件
    aline = file.readline()  # 读取一行  '1\n'
    if aline == '':
        break
    s = aline[:-1]  # 去掉'\n'
    total += int(s)
print("和是", total)
file.close()
